package com.cyz.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cyz.dao.TypeDao;
import com.cyz.entity.TypeEntity;
import com.cyz.service.TypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 *
 *
 * @author chenyizhen
 * @email sunlightcs@gmail.com
 * @date 2023-12-18 15:02:10
 */
@RestController
@RequestMapping("user/type")
public class TypeController {

    @Autowired
    TypeDao typeDao;

    @PostMapping("select")
    public List<String> list(){
        return typeDao.selectList(new QueryWrapper<>()).stream().map(item -> item.getName()).collect(Collectors.toList());
    }

    @PostMapping("selectOne")
    public TypeEntity selectByName(String name){
        return typeDao.selectOne(new QueryWrapper<TypeEntity>().eq("name", name));
    }
}
